package com.hospes.rmes.core.databases;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DBHendler extends SQLiteOpenHelper {
	private final static String DB_NAME = "rmes.db";
	private final static int DB_VERSION = 1;

	public DBHendler(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("create table " + DatabaseField.TABLE_NEWS + "(" + DatabaseField.TABLE_NEWS_ID + " integer primary key autoincrement, " + DatabaseField.TABLE_NEWS_TITLE + " text, " + DatabaseField.TABLE_NEWS_TEASER + " text, " + DatabaseField.TABLE_NEWS_DATE + " text, " + DatabaseField.TABLE_NEWS_TEXT + " text, " + DatabaseField.TABLE_NEWS_FILES + " text);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("drop table if exists " + DatabaseField.TABLE_NEWS);
	}
}
